/*
  ==============================================================================

    Generator.h
    Created: 30 Nov 2014 5:16:40pm
    Author:  Alistair Barker

  ==============================================================================
*/

#ifndef GENERATOR_H_INCLUDED
#define GENERATOR_H_INCLUDED

#include "../JuceLibraryCode/JuceHeader.h"

const int wave_length = 4096.0;


class Generator
{
public:
    Generator ();
    
    void setSampleRate(double fs) {sampleRate = fs;};
    void setFrequency(double freq) {frequency = freq;};
    void setOutputType(int outputType) {type = outputType;};
    
    double getNextSample();
    void getNextAudioBlock(AudioSampleBuffer &buffer);
    
    enum {
        kSine,
        kSquare,
        kSaw,
        kTriangle,
        kWhiteNoise,
        kPinkNoise
    };
    
    
    
private:
    
    
    int readHead;
    double sampleRate;
    int type;
    
    double frequency;
    double sinWavetable[wave_length];
    double squareWavetable[wave_length];
    double sawWavetable[wave_length];
    double triangleWavetable[wave_length];


};



#endif  // GENERATOR_H_INCLUDED
